#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
    File Name:      dimen_tool
    Author:         'daze'
    date:           2019/1/11
"""
from AutoWool.main.utils.dimen_utils import DimenUtils, cur_pc_screen_w, cur_pc_screen_h, standard_pc_screen_w, \
    standard_pc_screen_h, cur_phone_screen_h, standard_phone_screen_h, cur_phone_screen_w, standard_phone_screen_w
from AutoWool.main.utils.log_utils import Log

if __name__ == '__main__':
    while True:
        result = input('请输入选项：      \n0.获得当前电脑和手机的分辨率  \n1.生成 dimen 目录  \n2.转换电脑非标准坐标到标准坐标  \n3.转换手机非标准的坐标到标准坐标  \n4.退出程序 \n')
        if int(result) == 0:
            Log.log('当前 pc 屏幕分辨率为 width=' + str(cur_pc_screen_w) + ' height=' + str(cur_pc_screen_h))
            Log.log('当前 phone 屏幕分辨率为 width=' + str(cur_phone_screen_w) + ' height=' + str(cur_phone_screen_h))
        elif int(result) == 1:
            input('修改了 dimen_utils 里的 target_dimen_list 里吗？按任意键继续')
            DimenUtils.gen_dimens()
            Log.log('生成 dimen 目录完毕')
        elif int(result) == 2:
            Log.log('开始转换电脑非标准的坐标到标准坐标' + str(standard_pc_screen_w) + 'x' + str(standard_pc_screen_h))
            DimenUtils.trans_pc_dimen_to_standard()
        elif int(result) == 3:
            Log.log('开始转换手机非标准的坐标到标准坐标:' + str(standard_phone_screen_w) + 'x' + str(standard_phone_screen_h))
            result_tuple = DimenUtils.trans_phone_dimen_to_standard()
            Log.log('转换到当前手机分辨率的坐标为:(' + str(DimenUtils.map_x_phone(result_tuple[0])) + 'x' + str(
                DimenUtils.map_y_phone(result_tuple[1])) + ')')
        else:
            break